import React, { Component } from 'react'
//路由传参
import {withRouter} from "react-router-dom"
import { ImagePicker, WingBlank, SegmentedControl } from 'antd-mobile';
import "./canvas.sass"
const data = [{
    url: 'https://zos.alipayobjects.com/rmsportal/PZUUCKTRIHWiZSY.jpeg',
    id: '2121',
  }, {
    url: 'https://zos.alipayobjects.com/rmsportal/hqQWgTXdrlmVVYi.jpeg',
    id: '2122',
  }];
class Canvas extends Component {
    
    state = {
        files: data,
        multiple: false,
    }

    handleClick = (params) => {
        //this.props.history.push("/searchCenter");
    }

    onChange = (files, type, index) => {
        console.log(files, type, index);
        this.setState({
          files,
        });
      }
    onSegChange = (e) => {
      const index = e.nativeEvent.selectedSegmentIndex;
      this.setState({
        multiple: index === 1,
      });
    }
    
    render() {
        const { files } = this.state;
        return (
            <WingBlank>
        
                <ImagePicker
                files={files}
                onChange={this.onChange}
                onImageClick={(index, fs) => console.log(index, fs)}
                selectable={files.length < 7}
                multiple={this.state.multiple}
                />
      </WingBlank>
        )
    }
}
export default withRouter(Canvas)
